package com.cloud.pora.mrm.web.common.themes;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.faces.context.FacesContext;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

@Scope(ScopeType.SESSION)
@Name("guestPreferences")
public class GuestPreferences implements Serializable {

	private String theme = "bluesky"; // default sunny

	private List<Theme> themes;

	public String getTheme() {
		Map<String, String> params = FacesContext.getCurrentInstance()
				.getExternalContext().getRequestParameterMap();
		if (params.containsKey("theme")) {
			theme = params.get("theme");
		}

		return theme;
	}

	public void setTheme(String theme) {
		this.theme = theme;
	}

	public void init() {
		themes = new ArrayList<Theme>();
		themes.add(new Theme("afterdark", "afterdark.png"));
		themes.add(new Theme("afternoon", "afternoon.png"));
		themes.add(new Theme("afterwork", "afterwork.png"));
		themes.add(new Theme("aristo", "aristo.png"));
		themes.add(new Theme("black-tie", "black-tie.png"));
		themes.add(new Theme("blitzer", "blitzer.png"));
		themes.add(new Theme("bluesky", "bluesky.png"));
		themes.add(new Theme("bootstrap", "bootstrap.png"));
		themes.add(new Theme("casablanca", "casablanca.png"));
		themes.add(new Theme("cruze", "cruze.png"));
		themes.add(new Theme("cupertino", "cupertino.png"));
		themes.add(new Theme("dark-hive", "dark-hive.png"));
		themes.add(new Theme("dot-luv", "dot-luv.png"));
		themes.add(new Theme("eggplant", "eggplant.png"));
		themes.add(new Theme("excite-bike", "excite-bike.png"));
		themes.add(new Theme("flick", "flick.png"));
		themes.add(new Theme("glass-x", "glass-x.png"));
		themes.add(new Theme("home", "home.png"));
		themes.add(new Theme("hot-sneaks", "hot-sneaks.png"));
		themes.add(new Theme("humanity", "humanity.png"));
		themes.add(new Theme("le-frog", "le-frog.png"));
		themes.add(new Theme("midnight", "midnight.png"));
		themes.add(new Theme("mint-choc", "mint-choc.png"));
		themes.add(new Theme("overcast", "overcast.png"));
		themes.add(new Theme("pepper-grinder", "pepper-grinder.png"));
		themes.add(new Theme("redmond", "redmond.png"));
		themes.add(new Theme("rocket", "rocket.png"));
		themes.add(new Theme("sam", "sam.png"));
		themes.add(new Theme("smoothness", "smoothness.png"));
		themes.add(new Theme("south-street", "south-street.png"));
		themes.add(new Theme("start", "start.png"));
		themes.add(new Theme("sunny", "sunny.png"));
		themes.add(new Theme("swanky-purse", "swanky-purse.png"));
		themes.add(new Theme("trontastic", "trontastic.png"));
		themes.add(new Theme("ui-darkness", "ui-darkness.png"));
		themes.add(new Theme("ui-lightness", "ui-lightness.png"));
		themes.add(new Theme("vader", "vader.png"));

	}

	public List<Theme> getThemes() {
		if (themes == null) {
			init();
		}
		return themes;
	}

	public void saveTheme() {
		setTheme(theme);
	}

}
